Custom internal search engine [migrated]
Posted
by
nobody
on Programmers
See other posts from Programmers
or by nobody
Published on 2014-06-12T14:25:52Z
Indexed on
2014/06/12
15:38 UTC
Read the original article
Hit count: 138
I am building a social network, and I need a simple internal search engine that will display a list of all website users starting with the ones that have the specific keyword in their username. So here is what i need:
a search engine that will take a keyword. the search engine will open a new page with a list of all website users, displaying first the users that have the specific keyword in their username. display your username in the placeholder. So, here is what I have so far:
<div class="logobox r">
<form method="post" action="../sity/search.php"> <!--will redirect you to a new page with a list of all website users.-->
<input type="text" class="logo" name="searchUser" placeholder="<?php echo $comObj->getSession('username')?>"> <!--will take a keyword as a imput, and will display your username in the placeholder-->
<button type="submit" class="sity" value="sity">sity</button>
</form>
</div>
And here is the searchUser function:
function searchUser($keyword) {
$commObj = new common;
$sql = "SELECT `id`,`username`, `profile_pic` FROM ".$this->tables['user']." WHERE `username` LIKE '%".$keyword."%' AND `id` <> ".$commObj->getSession('userid');
$result = $this->selectAll($sql);
unset($this->rsa);
return $result;
}
The problem is that when you click on the search box, instead of letting you to enter a keyword, the page will logout you from the website. I still can't figure out why.
Here is the link to the website: www.sity.net
Any suggestion will be highly appreciated.
Thanks
© Programmers or respective owner